local ActorBase = require("gameLogic.fight.ActorBase")
local StandingActor = class("StandingActor", ActorBase)
local GameUtils = require("utils.GameUtils")

function StandingActor:ctor(manager, id, resPath)
    printDebug("Prefabs/" .. resPath)
    local object = G_ResourceManager:loadPrefabs("Prefabs/" .. resPath)
    StandingActor.super.ctor(self, manager, id, object)
    -- self._bloodUI = require("gameLogic.ui.BloodUI").new(self)
end

function StandingActor:delete()
    GameUtils.destroy(self.gameObject)
    -- self._bloodUI:close()
end

function StandingActor:setBloodValue(value, maxBlood, isDie)
    self._value = value
    self._value = self._value < 0 and 0 or self._value
    self._maxBlood = maxBlood
    -- if self._bloodUI then
    --     self._bloodUI:setValue(value, maxBlood)
    -- end
    if isDie then
        self:setDie(true)
    end
end

function StandingActor:subBlood(hurt)
    self._value = self._value - hurt.value
    self._value = self._value < 0 and 0 or self._value
    -- if self._bloodUI then
    --     self._bloodUI:setValue(self._value, self._maxBlood)
    -- end
    if hurt.die then
        self:setDie(true)
    end
end

return StandingActor
